

@RestController
@RequestMapping("/fmsMaterialUnit")
public class FmsMaterialUnitController {

    @Resource
    private FmsMaterialUnitService fmsMaterialUnitService;


    /**
     * 获取 FmsMaterialUnit 分页列表
     */
    @GetMapping("/pagination")
    public Ret getFmsMaterialUnitPagination( PaginationVo paginationVo, FmsMaterialUnitQuery fmsMaterialUnitQuery ) throws Exception {
        IPage page = fmsMaterialUnitService.getFmsMaterialUnitPagination(paginationVo, fmsMaterialUnitQuery );
        return Ret.toPage(page);
    }


    /**
     * 获取 FmsMaterialUnit 所有数据
     */
    @GetMapping("/all")
    public Ret getFmsMaterialUnitAllList( FmsMaterialUnitQuery fmsMaterialUnitQuery ) throws Exception {
        List<FmsMaterialUnitEntity> list = fmsMaterialUnitService.getFmsMaterialUnitAllList( fmsMaterialUnitQuery );
        return Ret.ok(list);
    }



    /**
     * 获取 FmsMaterialUnit 详情
    */
   @GetMapping("/{id}")
   public Ret getFmsMaterialUnitDetail(@PathVariable Long id) throws Exception {

       FmsMaterialUnitEntity fmsMaterialUnit = fmsMaterialUnitService.getFmsMaterialUnitDetail(id);
       return Ret.ok(fmsMaterialUnit);
   }


    /**
     * 新增 FmsMaterialUnit
     * */
    @PostMapping("")
    public Ret addFmsMaterialUnit(@RequestBody FmsMaterialUnitVo fmsMaterialUnitVo) throws Exception {

        fmsMaterialUnitService.addFmsMaterialUnit(fmsMaterialUnitVo);
        return Ret.ok();
    }


    /**
     * 更新 FmsMaterialUnit
     * */
    @PutMapping("")
    public Ret updateFmsMaterialUnit(@RequestBody FmsMaterialUnitVo fmsMaterialUnitVo) throws Exception {

        fmsMaterialUnitService.updateFmsMaterialUnit(fmsMaterialUnitVo);
        return Ret.ok();
    }


    /**
     * 删除 FmsMaterialUnit
     * */
    @PostMapping("/batchRemove")
    public Ret batchRemoveFmsMaterialUnit( @RequestBody List<Long> ids ) throws Exception {

        fmsMaterialUnitService.batchRemoveFmsMaterialUnit(ids);
        return Ret.ok();
    }
}

  